Skip to content

inject custom css into app meta#9

Merged
kyrregjerstad merged 1 commit intologto-bitfocusfrom
chore/update-login-experience
Oct 31, 2025
Merged

inject custom css into app meta#9
kyrregjerstad merged 1 commit intologto-bitfocusfrom
chore/update-login-experience

Conversation

@kyrregjerstad
Copy link
Copy Markdown

Moves the custom CSS from the login experience into the logto package. This way, a user can override it easy, but still have this as the base without worrying about losing the base styling.

Mostly formatting changes, only new code is:

import bitfocusCustomStyles from './bitfocus-custom-styles.css?raw'
// ...
{bitfocusCustomStyles && <style>{bitfocusCustomStyles}</style>}

@github-actions
Copy link
Copy Markdown

COMPARE TO master

Total Size Diff ⚠️ 📈 +50.4 KB

Diff by File
Name Diff
packages/console/src/components/Topbar/index.tsx 📈 +888 Bytes
packages/console/src/containers/ConsoleContent/Sidebar/hook.tsx 📈 +190 Bytes
packages/core/package.json 📈 +24 Bytes
packages/core/src/index.ts 📈 +452 Bytes
packages/core/src/main.ts 📈 +278 Bytes
packages/core/src/middleware/koa-cors.ts 📈 +312 Bytes
packages/core/src/middleware/koa-security-headers.ts 📈 +276 Bytes
packages/core/src/routes/experience/verification-routes/password-verification.ts 📈 +174 Bytes
packages/core/src/utils/buttons-app-starter/appStarter.ts 📈 +6.1 KB
packages/core/src/utils/buttons-app-starter/redis.ts 📈 +3.54 KB
packages/core/src/utils/password-decryption.ts 📈 +3.24 KB
packages/core/src/utils/watchdog.ts 📈 +3.9 KB
packages/experience/package.json 📈 +64 Bytes
packages/experience/src/Providers/AppBoundary/AppMeta.tsx 📈 +145 Bytes
packages/experience/src/Providers/AppBoundary/bitfocus-custom-styles.css 📈 +6 KB
packages/experience/src/assets/buttons.png ⚠️ 📈 +19.09 KB
packages/experience/src/constants/env.ts 📈 +101 Bytes
packages/experience/src/hooks/use-encryption.ts 📈 +5.44 KB
packages/experience/src/hooks/use-external-iframe-signin.ts 📈 +1.17 KB
packages/experience/src/hooks/use-password-sign-in.ts 📈 +145 Bytes
packages/experience/src/pages/SignIn/index.tsx 📈 +89 Bytes
packages/experience/src/utils/crypto.ts 📈 +662 Bytes
packages/experience/vite.config.ts 📈 +53 Bytes
packages/schemas/src/types/interactions.ts 📈 +361 Bytes
packages/shared/src/node/env/UrlSet.ts 📈 +35 Bytes
pnpm-lock.yaml 📈 +2.09 KB

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @kyrregjerstad, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request streamlines the management of custom styling within the application by relocating specific CSS rules into a dedicated file. This change establishes a foundational visual theme for the login and overall app experience, while simultaneously enhancing its customizability. By injecting this base styling before any user-defined overrides, it ensures a consistent look that can still be tailored as needed, improving both maintainability and flexibility.

Highlights

  • Custom CSS Injection: A new custom CSS file, bitfocus-custom-styles.css, has been introduced and is now injected into the application's meta, providing a base styling layer for the login experience.
  • Styling Overridability: The newly injected custom CSS is placed in a way that allows existing experienceSettings.customCss to easily override it, ensuring flexibility for further customization.
  • Code Formatting: Minor formatting adjustments were made in AppMeta.tsx, primarily changing semicolons to be omitted for consistency.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@kyrregjerstad kyrregjerstad merged commit e07c19f into logto-bitfocus Oct 31, 2025
11 of 21 checks passed
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a base set of custom styles for the login experience, which can be overridden by user-provided CSS. The implementation in AppMeta.tsx correctly injects the styles. However, the new CSS file bitfocus-custom-styles.css has several issues that need to be addressed. The styles are hardcoded for a dark theme and will not work correctly in light mode. There is also a likely broken image path and some maintainability concerns regarding brittle selectors and inconsistent comments. I've left detailed comments with suggestions for improvement.

Comment on lines +14 to +17
#app > div[class$='viewBox'] {
background: #0a0a0a;
min-height: 100vh;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The custom styles appear to be designed only for a dark theme, with hardcoded dark background and light text colors. However, the application supports both light and dark themes via a data-theme attribute on the <html> tag. These styles do not respect the current theme, which will result in poor readability and an incorrect appearance in light mode.

You should adapt these styles to work with both themes. You can use the [data-theme='light'] and [data-theme='dark'] selectors to provide theme-specific styles.

For example:

/* Default (dark theme) styles */
#app > div[class$='viewBox'] {
  background: #0a0a0a;
}

/* Light theme overrides */
[data-theme='light'] #app > div[class$='viewBox'] {
  background: #ffffff; /* Example light color */
}

Alternatively, using CSS variables that change based on the theme would be an even better approach for maintainability.

}

#app main[class*='main'] img[class*='logo'] {
content: url('src/assets/buttons.png');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The path url('src/assets/buttons.png') is unlikely to work correctly in a production build. This CSS is injected as a raw string into a <style> tag in the document's <head>. The URL will be resolved relative to the page's URL, not the CSS file's source location. This means the browser will try to fetch https://<your-domain>/src/assets/buttons.png, which will likely result in a 404 error.

To fix this, you should use a path that is correct relative to the final deployment structure (e.g., an absolute path like /assets/buttons.png if your assets are served from an assets directory at the root).

A more robust solution would be to import the image in your TypeScript/JavaScript code to let the bundler (Vite) handle it, and then pass the resulting URL to your CSS, for example via a CSS variable. Another option is to inline the image as a data URI if it's small.


#app main[class*='main'] div[class*='headline'] {
color: #d4d4d4;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line has trailing whitespace. While this doesn't affect functionality, it's good practice to remove it to keep the code clean and consistent. Many code editors can be configured to do this automatically on save.

  color: #d4d4d4;

Comment on lines +189 to +190
background-color: #3b82f6; /* bitfocus-500 */
color: #0f172a;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There seems to be an inconsistency with the color value for bitfocus-500. Here, background-color is set to #3b82f6 (blue) with a comment /* bitfocus-500 */. However, on line 171, the submit button's background is set to #F0BE35 (yellow) with a comment matches bg-bitfocus-500 styling.

Please verify which color is the correct one for bitfocus-500 and update the CSS and/or comments accordingly to avoid confusion.


/* Hide the clear (suffix) button on identifier input */
#app form div[class*='inputField'] [class$='suffix'] {
display: none !important;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The use of !important should generally be avoided as it can make stylesheets difficult to debug and override later. It breaks the natural cascade of CSS.

Please check if you can achieve the same result by increasing the selector's specificity. For example, a more specific selector might be able to override the display property without needing !important.

If !important is truly necessary here to override an inline style or another !important rule, it would be good to add a comment explaining why it's needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant